/*
 * Copyright (c) 2023, LXMS (lxinet.cn).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cn.lxinet.lxms.system.entity;

import cn.lxinet.lxms.framework.mybatis.annotation.Id;
import cn.lxinet.lxms.framework.mybatis.annotation.Ignore;
import cn.lxinet.lxms.framework.mybatis.annotation.LogicDel;
import cn.lxinet.lxms.framework.mybatis.annotation.Table;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 系统登录日志
 *
 * @author zcx
 * @date 2023/07/08
 */
@Data
@Schema(description = "系统登录日志")
@Table("sys_login_log")
public class SysLoginLog implements Serializable{
    @Ignore
    private static final long serialVersionUID = 1L;

    @Schema(description = "登录ID")
    @Id
    private Long id;

    @Schema(description = "登录账号")
    private String account;

    @Schema(description = "登录类型，0账号密码登录，1手机号密码登录，2手机号验证码登录")
    private Integer loginType;

    @Schema(description = "登录IP地址")
    private String ip;

    @Schema(description = "登录地点")
    private String location;

    @Schema(description = "浏览器类型")
    private String browser;

    @Schema(description = "user-agent")
    private String userAgent;

    @Schema(description = "操作系统")
    private String os;

    @Schema(description = "登录状态，0失败 1成功")
    private Integer status;

    @Schema(description = "是否删除，0未删除，1删除")
    @LogicDel
    private Integer deleted;

    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    @Schema(description = "更新时间")
    private LocalDateTime updateTime;

    public SysLoginLog(String account, Integer status, String ip, String os, String browser, String userAgent){
        this.account = account;
        this.status = status;
        this.ip = ip;
        this.os = os;
        this.browser = browser;
        this.userAgent = userAgent;
    }
}